Repository navigation
feat: expect a condition after input whose outcome is unknown - #89
Merged
Merged
Conversation
iamnbutler
force-pushed
the
feat/expect
branch
from
October 17, 2026 07:25
464ee7f to
85ca91a
Compare
…mplete it when the condition holds
iamnbutler
force-pushed
the
feat/expect
branch
from
October 17, 2026 07:35
85ca91a to
7edc43e
Compare
This was referenced Oct 17, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
desktop_click,desktop_key,desktop_system_key,desktop_draganddesktop_insertnow take an optionalexpect: onedesktop_waitcondition with its arguments, naming what the action should change. From the #75 refresh (top 3, item 3).desktop_waituses. If it already holds, or can't be read reliably (the read fails, or the poll reports an error), the action is refused with nothing sent, because a match afterward wouldn't show the action's effect. Fortext_changes, that read is the baseline, so the change is measured from before input.unknownoutcome polls the condition withdesktop_wait's backoff fortimeout_ms: 3 s by default, 10 s at most.completed, withaction.native_outcome: "unknown"andexpectation(statusmatched, the match, and a fresh snapshot forelement_appears).unknown, withexpectation.last_observation.unknown, with expectation statusinterrupted.completedorrefusedoutcome is returned unchanged, with no polling.DESKTOP_EXPECT_OPSin protocol.ts lists the ops, the schema is the sharedwaitConditionplustimeout_ms, andexpectAfter(reads, condition, act)in wait.ts wraps any action. A direct client request withexpecton another op is refused before input.waitForandexpectAfternow sharepoll()andreport(), andvalidateWaittakes the timeout cap.Tests:
test/expect.test.mjshas 9 tests, covering the cases below.npm testpasses 35 of 35, andnpm run checkpasses.Live checks are pending: screen locked; they're added to #42:
expect: {until: "window_appears", bundle_id: "com.apple.Spotlight"}should be completed.expectelement_appears is either completed, or unknown with the last observation.